package com.fz.us.oa.core.entity.com;

import com.fz.us.admin.company.entity.BaseFlowEntity;
import com.fz.us.admin.dict.entity.DictItem;
import com.fz.us.oa.core.entity.common.FileManage;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * Created by dzw on 2018/3/13.
 * 人员信息表
 */
@Entity
@Table(name = "dj_person")
public class Person extends BaseFlowEntity {
    private static final long serialVersionUID = 5800952683410724527L;


    /**
     * 换届区间（换届前2015-2018  换届后2018-2021）
     */
    private DictItem generalDict;


    /**
     * keyId 为了导入导出数据，区分是新建人员还是编辑人员，另外弄个"假主键"（查询的时候id和keyid全都查，有的话就是编辑，没有的话就是新建）
     */
    private String keyId;

    /**
     * 性别
     */
    private String gender;
    /**
     * 出生日期
     */
    private Date birthday;
    /**
     * 民族
     */
    private DictItem nation;
    /**
     * 籍贯
     */
    private String origin;
    /**
     * 出生地
     */
    private String birthPlace;
    /**
     * 入党时间
     */
    private Date joinPartyDate;
    /**
     * 参加工作时间
     */
    private Date joinWorkDate;
    /**
     * 健康状况
     */
    private String health;
    /**
     * 专业技术职务（这个目前没有用，隐藏掉）
     */
    private String txtTecDuty;
    /**
     * 熟悉专业有何专长
     */
    private String specialty;
    /**
     * 工作性质
     */
    private DictItem workNature;
    /**
     * 人员性质
     */
    private DictItem personNature;
    /**
     * 最高学历
     */
    private DictItem highEdu;
    /**
     * 全日制教育
     */
    private DictItem allDayEdu;
    /**
     * 毕业院校系及专业
     */
    private String allDaySchool;
    /**
     * 在职教育
     */
    private DictItem jobEdu;
    /**
     * 毕业院校系及专业
     */
    private String jobSchool;
    /**
     * 现任职务
     */
    private String nowPost;
    /**
     * 现任职时间
     */
    private Date nowPostDate;
    /**
     * 所在区
     */
    private String area;
    /**
     * 所在街道
     */
    private DictItem street;
    /**
     * 照片
     */
    private FileManage photo;
    /**
     * 奖惩情况
     */
    private String reward;

    // ===== 2015 ~ 2018 =====
    /**
     * 居民区
     */
    private Resident resident;
    /**
     * 一肩挑书记情况 0否 1一肩挑
     */
    private int shoulder;
    /**
     * 一肩挑书记详情 已一肩挑，拟一肩挑连任，拟一肩挑备选
     */
    private String shoulderDet;

    /**
     * 身份证号
     */
    private String cardId;

    // ===== 2018 ~ 2021 ===== 同上
//    private Resident resident1;
    private int shoulder1;
//    private String shoulderDet1;
//    private DictItem personNature1;

    // ---------- 家庭信息 -----------
    /**
     * 家庭地址
     */
    private String familyAddress;
    /**
     * 联系电话
     */
    private String phone;
    /**
     * 邮编
     */
    private String zipCode;

    // ---------- 关联表 ------------
    /**
     * 学习经历
     */
    private List<Study> studyList;
    /**
     * 工作经历
     */
    private List<Work> workList;
    /**
     * 家庭信息
     */
    private List<Family> familyList;

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getNation() {
        return nation;
    }

    public void setNation(DictItem nation) {
        this.nation = nation;
    }

    public String getOrigin() {
        return origin;
    }

    public void setOrigin(String origin) {
        this.origin = origin;
    }

    public String getBirthPlace() {
        return birthPlace;
    }

    public void setBirthPlace(String birthPlace) {
        this.birthPlace = birthPlace;
    }

    public Date getJoinPartyDate() {
        return joinPartyDate;
    }

    public void setJoinPartyDate(Date joinPartyDate) {
        this.joinPartyDate = joinPartyDate;
    }

    public Date getJoinWorkDate() {
        return joinWorkDate;
    }

    public void setJoinWorkDate(Date joinWorkDate) {
        this.joinWorkDate = joinWorkDate;
    }

    public String getHealth() {
        return health;
    }

    public void setHealth(String health) {
        this.health = health;
    }

    public String getSpecialty() {
        return specialty;
    }

    public void setSpecialty(String specialty) {
        this.specialty = specialty;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getWorkNature() {
        return workNature;
    }

    public void setWorkNature(DictItem workNature) {
        this.workNature = workNature;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getPersonNature() {
        return personNature;
    }

    public void setPersonNature(DictItem personNature) {
        this.personNature = personNature;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getHighEdu() {
        return highEdu;
    }

    public void setHighEdu(DictItem highEdu) {
        this.highEdu = highEdu;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getAllDayEdu() {
        return allDayEdu;
    }

    public void setAllDayEdu(DictItem allDayEdu) {
        this.allDayEdu = allDayEdu;
    }

    public String getAllDaySchool() {
        return allDaySchool;
    }

    public void setAllDaySchool(String allDaySchool) {
        this.allDaySchool = allDaySchool;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getJobEdu() {
        return jobEdu;
    }

    public void setJobEdu(DictItem jobEdu) {
        this.jobEdu = jobEdu;
    }

    public String getJobSchool() {
        return jobSchool;
    }

    public void setJobSchool(String jobSchool) {
        this.jobSchool = jobSchool;
    }

    public String getNowPost() {
        return nowPost;
    }

    public void setNowPost(String nowPost) {
        this.nowPost = nowPost;
    }

    public Date getNowPostDate() {
        return nowPostDate;
    }

    public void setNowPostDate(Date nowPostDate) {
        this.nowPostDate = nowPostDate;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getStreet() {
        return street;
    }

    public void setStreet(DictItem street) {
        this.street = street;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public Resident getResident() {
        return resident;
    }

    public void setResident(Resident resident) {
        this.resident = resident;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public FileManage getPhoto() {
        return photo;
    }

    public void setPhoto(FileManage photo) {
        this.photo = photo;
    }

    @Type(type = "text")
    public String getReward() {
        return reward;
    }

    public void setReward(String reward) {
        this.reward = reward;
    }

    public String getFamilyAddress() {
        return familyAddress;
    }

    public void setFamilyAddress(String familyAddress) {
        this.familyAddress = familyAddress;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "li_person_study", joinColumns = @JoinColumn(name="id"),inverseJoinColumns = @JoinColumn(name="studyId"))
    public List<Study> getStudyList() {
        return studyList;
    }

    public void setStudyList(List<Study> studyList) {
        this.studyList = studyList;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "li_person_work", joinColumns = @JoinColumn(name="id"),inverseJoinColumns = @JoinColumn(name="workId"))
    public List<Work> getWorkList() {
        return workList;
    }

    public void setWorkList(List<Work> workList) {
        this.workList = workList;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "li_person_family", joinColumns = @JoinColumn(name="id"),inverseJoinColumns = @JoinColumn(name="familyId"))
    public List<Family> getFamilyList() {
        return familyList;
    }

    public void setFamilyList(List<Family> familyList) {
        this.familyList = familyList;
    }

    public int getShoulder() {
        return shoulder;
    }

    public void setShoulder(int shoulder) {
        this.shoulder = shoulder;
    }

    public String getShoulderDet() {
        return shoulderDet;
    }

    public void setShoulderDet(String shoulderDet) {
        this.shoulderDet = shoulderDet;
    }

    public String getTxtTecDuty() {
        return txtTecDuty;
    }

    public void setTxtTecDuty(String txtTecDuty) {
        this.txtTecDuty = txtTecDuty;
    }

    public String getKeyId() {
        return keyId;
    }

    public void setKeyId(String keyId) {
        this.keyId = keyId;
    }

//    @ManyToOne(fetch = FetchType.LAZY)
//    public Resident getResident1() {
//        return resident1;
//    }
//
//    public void setResident1(Resident resident1) {
//        this.resident1 = resident1;
//    }
//
    public int getShoulder1() {
        return shoulder1;
    }

    public void setShoulder1(int shoulder1) {
        this.shoulder1 = shoulder1;
    }
//
//    public String getShoulderDet1() {
//        return shoulderDet1;
//    }
//
//    public void setShoulderDet1(String shoulderDet1) {
//        this.shoulderDet1 = shoulderDet1;
//    }
//
//    @ManyToOne(fetch = FetchType.LAZY)
//    public DictItem getPersonNature1() {
//        return personNature1;
//    }
//
//    public void setPersonNature1(DictItem personNature1) {
//        this.personNature1 = personNature1;
//    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getGeneralDict() {
        return generalDict;
    }

    public void setGeneralDict(DictItem generalDict) {
        this.generalDict = generalDict;
    }

    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }
}
